<#include "/public/secfield.html">

<div class="layui-side-scroll" style="background-color: #f2f2f2;">
	<div class="row">
		<div class="col-lg-12">
			<h1 class="site-h1" style="border-right:1px solid #e6e6e6;">
				审计日志概况
				<span style="float:right;color:#aaa;font-size:14px;">
				<span><a href="/admin/reqlog/desktop.html" 
						data-toggle="load" data-target="#ukefu-reqlog-content">
							<i class="layui-icon" style="font-size:16px;color:#aaa;">&#xe669;</i></a>
				</span>
				最后刷新时间：${.now?string("yyyy-MM-dd HH:mm:ss")}
				</span>
				<span style="float:right;color:#aaa;font-size:14px;">
					<input type="text" name="reflashdate" class="layui-input"  id="reflashdate" readonly="readonly" style="width: 345px;height: 33px;" value="<#if reflashbegin?? && reflashend??>${reflashbegin!''}到 ${reflashend!''}</#if>">
					<i class="layui-icon" style="position: absolute;right: 268px;top: 7px;font-size: 25px;">&#xe637;</i>
				</span>
			</h1>
			<div class="row">
				<div class="col-lg-3">
					<div class="uk-measure uk-border">
						<div class="uk-measure-header">
							触发预警
							<span class="uk-badge layui-bg-blue" title="总量">总</span>
						</div>
						<div class="uk-measure-body">
							<div class="ukefu-measure-title" >
								<a href="javascript:void(0);" style="text-decoration:none;cursor:default;">
								<#if triggertimecount??>${triggertimecount!''}<#else>0</#if>
								</a>
							</div>
							<div class="ukefu-bt-text-content">
								拦截次数
								<span style="float:right;">
									<a href="javascript:void(0);" style="text-decoration:none;cursor:default;">
									<#if triggerwarningcount??>${triggerwarningcount!''}<#else>0</#if>
									</a>
								</span>
							</div>
						</div>
					</div>
				</div>
				<div class="col-lg-3">
					<div class="uk-measure uk-border">
						<div class="uk-measure-header">
							触发预警用户
							<span class="uk-badge layui-bg-blue" title="总量">个人</span>
						</div>
						<div class="uk-measure-body">
							<div class="ukefu-measure-title">
								<a href="javascript:void(0);" style="text-decoration:none;cursor:default;">
								<#if usertriggercount??>${usertriggercount!''}<#else>0</#if>
								</a>
							</div>
							<div class="ukefu-bt-text-content">
								被拦截的用户
								<span style="float:right;">
									<a href="javascript:void(0);" style="text-decoration:none;cursor:default;">
									<#if userwarningcount??>${userwarningcount!'0'}<#else>0</#if>
									</a>
								</span>
							</div>
						</div>
					</div>
				</div>	
				<div class="col-lg-3">
					<div class="uk-measure uk-border">
						<div class="uk-measure-header">
							平均请求耗时
							<!-- <span class="uk-badge" title="今天">今</span> -->
							<span class="uk-badge layui-bg-blue" title="">毫秒</span>
						</div>
						<div class="uk-measure-body">
							<div class="ukefu-measure-title">
								<a href="javascript:void(0);" style="text-decoration:none;cursor:default;">
								<#if querytimeavg??>${querytimeavg!''}<#else>0</#if>
								</a>
							</div>
							<div class="ukefu-bt-text-content">
								日志数量
								<span style="float:right;">
									<a href="javascript:void(0);" style="text-decoration:none;cursor:default;">
									<#if allcount??>${allcount!''}<#else>0</#if>
									</a>
								</span>
							</div>
						</div>
					</div>
				</div>
				<div class="col-lg-3">
					<div class="uk-measure">
						<div class="uk-measure-header">
							报错提示
							<span class="uk-badge layui-bg-blue" title="总量">次</span>
						</div>
						<div class="uk-measure-body">
							<div class="ukefu-measure-title">
								<a href="javascript:void(0);" style="text-decoration:none;cursor:default;">
								<#if errorcount??>${errorcount!'0'}<#else>0</#if>
								</a>
							</div>
							<div class="ukefu-bt-text-content">
								非用户操作
								<span style="float:right;">
									<a href="javascript:void(0);" style="text-decoration:none;cursor:default;">
									<#if notusercount??>${notusercount!''}<#else>0</#if>
									</a>
								</span>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-lg-12" >
			<h1 class="site-h1" style="border-top:1px solid #e6e6e6;border-right:1px solid #e6e6e6;margin-top:15px;">
				统计概览
			</h1>
			<div class="row">
				<div class="col-lg-12" style="background-color: white;">
					<div id="mountNode" ></div>
				</div>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-lg-12" >
			<h1 class="site-h1" style="border-top:1px solid #e6e6e6;border-right:1px solid #e6e6e6;margin-top:15px;">
				触发预警日志
			</h1>
			<#include "/admin/system/reqlog/include/loglist.html">
		</div>
	</div>
	
</div>
<script type="text/javascript">
var data = [{
    "name": "用户",
    "vote": <#if useridsize??>${useridsize!''}<#else>0</#if>
  }, {
    "name": "IP",
    "vote": <#if ipsize??>${ipsize!''}<#else>0</#if>
  }, {
    "name": "预警次数",
    "vote": <#if triggertimecount??>${triggertimecount!''}<#else>0</#if>
  }, {
    "name": "拦截次数",
    "vote": <#if triggerwarningcount??>${triggerwarningcount!''}<#else>0</#if>
  }];
  var chart = new G2.Chart({
    container: 'mountNode',
    forceFit: true,
    height: 400,
    padding: [60, 20, 40, 60]
  });
  chart.source(data, {
    vote: {
      min: 0
    }
  });
  chart.legend(false);
  chart.axis('vote', {
    labels: null,
    title: null,
    line: null,
    tickLine: null
  });
  chart.interval().position('name*vote').color('name', ['#01AAED', '#fec514', '#FF5722', '#daf0fd']);
  chart.render();
	
  layui.use(['laypage', 'layer'], function(){
	  var laypage = layui.laypage
	  ,layer = layui.layer;
	  <#if msg??>
	  top.layer.msg('${msg}');
	  </#if>
	  laypage.render({
			elem: 'page'
			,pages: <#if requestLogList??>${requestLogList.totalPages}<#else>0</#if> //总页数
			,curr:<#if requestLogList??>${requestLogList.number+1}<#else>0</#if>
			,groups: 5 //连续显示分页数
			,jump:function(data , first){
				if(!first){
					location.href = "/admin/reqlog/index.html?p="+data.curr
						<#if q?? && q != "" >+"&q=${q!''}"</#if>
						<#if username?? && username != "">+"&username=${username!''}"</#if>
						<#if userid?? && userid != "" >+"&userid=${userid!''}"</#if>
						<#if ip?? && ip != "">+"&ip=${ip!''}"</#if>
						<#if hostname?? && hostname != "">+"&hostname=${hostname!''}"</#if>
						<#if statues?? && statues != "">+"&statues=${statues!''}"</#if>
						<#if triggerwarning?? && triggerwarning !="">+"&triggerwarning=${triggerwarning!''}"</#if>
						<#if createdatebegin?? && createdatebegin != "">+"&createdatebegin=${createdatebegin!''}"</#if>
						<#if createdateend?? && createdateend != "">+"&createdateend=${createdateend!''}"</#if>
						<#if starttimebegin?? && starttimebegin != "">+"&starttimebegin=${starttimebegin!''}"</#if>
						<#if starttimeend?? && starttimeend != "">+"&starttimeend=${starttimeend!''}"</#if>
						<#if endtimebegin?? && endtimebegin != "">+"&endtimebegin=${endtimebegin!''}"</#if>
						<#if endtimeend?? && endtimeend != "">+"&endtimeend=${endtimeend!''}"</#if><#if triggertimebegin?? && triggertimebegin != "">+"&triggertimebegin=${triggertimebegin!''}"</#if>
						<#if triggertimeend?? && triggertimeend != "">+"&triggertimeend=${triggertimeend!''}"</#if>;
				}
			}
	   });
	});
layui.use('laydate', function(){
	  var laydate = layui.laydate;
	  laydate.render({
		  elem: '#reflashdate'
		  ,type: 'datetime'
		  ,range: "到"
		  ,done: function(value, date, endDate){
			  arr=value.split("到");
			  if(arr != null && arr.length>1){
			  	loadURL("/admin/reqlog/desktop.html?reflashbegin="+arr[0]+"&reflashend="+arr[1],"#ukefu-reqlog-content");
			  }
 		  }
		}); 
});
</script>